package com.street.mapper;

import com.street.entity.Cart;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CartMapper {

    List<Cart> list(Cart cart);

    @Update("update shopping_cart set number=#{number} where id=#{id}")
    void update(Cart cart);

    @Insert("insert into shopping_cart(name, image, user_id, dish_id, shop_id, dish_flavor, amount, create_time,number) " +
            "values(#{name},#{image},#{userId},#{dishId},#{shopId},#{dishFlavor},#{amount},#{createTime},#{number}) ")
    void insert(Cart cartQueue);

    @Delete("delete from shopping_cart where id=#{id}")
    void deleteById(Long id);

    @Delete("delete from shopping_cart where user_id=#{userId} and shop_id=#{shopId}")
    void clear(Long userId, Long shopId);


}
